package lab02.Test06;

import static java.lang.StrictMath.*;

/**
 * Created by lenovo on 2017/10/15.
 */
public class Triangle {
    double len1;
    double len2;
    double len3;

    Triangle() {
    }

    Triangle(double len1, double len2, double len3) {
        this.len1 = len1;
        this.len2 = len2;
        this.len3 = len3;
    }

    public double girth() {
        return len1 + len2 + len3;
    }       //求周长

    public double area() {
        double s = (len1 + len2 + len3) / 2;
        return sqrt(s * (s - len1) * (s - len2) * (s - len3));
    }       // 求面积

    boolean judge() {
        if (((len1 + len2) > len3) && (Math.abs(len1 - len2) < len3)) {
            return true;
        } else {
            return false;
        }
    }       //判断能否构成三角形

    public void modify(double len1, double len2, double len3) {
        this.len1 = len1;
        this.len2 = len2;
        this.len3 = len3;
    }       //修改边长

}
